#include "lh_multiedit.h"


void LH_MultiEditEve(void *widget)
{
    LH_WIDGET *DilgFoc = widget;
    
    if (DilgFoc->WidFlags & LH_WIDREDR)     
    {  
        if(DilgFoc->WidFlags & LH_SHOWHC)
        {
            if (*DilgFoc->Path1 != LH_NULL)
                LH_ShowBmpAt(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Path1);
        }
        else
            if (*DilgFoc->Path2 != LH_NULL)
            {
                if (LH_CmpStr((LH_S8 *)DilgFoc->Path2, "GUI/di0/lab3_2.bmp"))
                    TFT_FillRect(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Axis_X+DilgFoc->Length, DilgFoc->Axis_Y+DilgFoc->Width, 0x4228);
                else
                    LH_ShowBmpAt(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Path2);
            }
        
        LH_ShowStrRg(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Axis_X+DilgFoc->Length, DilgFoc->Axis_Y+DilgFoc->Width, DilgFoc->PData, DilgFoc->WidColor);
    }
}


void LH_MultiEditAdd(LH_WIDGET *widget, LH_S8 *str)
{
    LH_S8 *WidStr = widget->PData;
    LH_U16 i1 = 0;
    
    while (*WidStr != 0)
    {
        WidStr ++;
        i1 ++;
    }
    
    while (*str != 0)
    {
        if (i1 > LH_S8_MULTIEDIT_UNIT_SIZE-2)
            break;
        
        *WidStr++ = *str++;
        i1 ++;
    }
    
    *WidStr = 0;
}




